
package com.wake.widget.skin.handler;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;

import com.wake.widget.skin.NMUISkinHelper;

import org.jetbrains.annotations.NotNull;

public class NMUISkinRuleSrcHandler extends NMUISkinRuleDrawableHandler {

    @Override
    protected void handle(@NotNull View view, @NotNull String name, Drawable drawable) {

        if (view instanceof ImageView) {
            ((ImageView) view).setImageDrawable(drawable);
        } else if (view instanceof CompoundButton) {
            ((CompoundButton) view).setButtonDrawable(drawable);
        } else {
            NMUISkinHelper.warnRuleNotSupport(view, name);
        }
    }
}
